package com.sky.service.impl;

import com.sky.service.ShopService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @Description ShopServiceImpl
 * @Author zhuzi
 * @Date 2023/09/26
 */
@RequiredArgsConstructor
@Service
public class ShopServiceImpl implements ShopService {

    public static final String KEY = "SHOP_STATUS";

    private final RedisTemplate redisTemplate;

    /**
     * 修改商家营业状态
     *
     * @param status
     */
    @Override
    public void updateShopStatus(Integer status) {
        redisTemplate.opsForValue().set(KEY, status);
    }

    /**
     * 获取商家营业状态
     *
     * @return
     */
    @Override
    public Integer getShopStatus() {
        return (Integer) redisTemplate.opsForValue().get(KEY);
    }

}
